package com.wenhao.newcode.shopee.hard2019;

import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-07-17 15:49
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int n = scanner.nextInt();
        int[][] result = new int[x + 1][y + 1];
        result[x][y] = 1;
        int[][] boss = new int[x + 1][y + 1];
        for (int i = 0;i < n;i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            boss[a][b] = -1;
        }
        for (int i = x;i > -1;i--) {
            for (int j = y;j > -1;j--) {
                if (boss[i][j] == -1) {
                    result[i][j] = 0;
                    continue;
                }
                if (i != x && j != y) {
                    result[i][j] = result[i + 1][j] + result[i][j + 1];
                }else if (i != x) {
                    result[i][j] = result[i + 1][j];
                }else if (j != y) {
                    result[i][j] = result[i][j + 1];
                }
            }
        }
        System.out.println(result[0][0]);
    }
}
